<div class="page-header">
  <h1>Listagem <small>Clientes</small></h1>
</div>

<ul class="breadcrumb">
  <li><a href="<?php echo $this->baseUrl() ?>/index">Home</a> <span class="divider">/</span></li>
  <li class="active">Listar Clientes</li>
</ul>

<?php if (!empty($this->msg)): ?>
    <div class="alert alert-success alert-dismissable">
        <button type="button" class="close" data-dismiss="alert" aria-hidden="true">&times;</button>
        <?php echo $this->msg; ?>
    </div>
<?php endif; ?>


<table class="table table-hover">
	<thead>
		<th>#</th>
		<th>Nome</th>
		<th>CPF</th>
                <?php if ($session->role == Role::ADMINISTRADOR): ?>
		<th></th>
                <?php endif ?>
	</thead>
	<tbody>
		<?php foreach ($this->clientes as $cliente): ?>
			<tr>
				<td><?php echo $cliente->id?></td>
				<td><?php echo $cliente->nome?></td>
				<td><?php echo $cliente->cpf?></td>
                                
				<td>
                                <?php if ($this->session->role == Role::ADMINISTRADOR): ?>
                                <a href="#modal-container-<?php echo $cliente->id?>" role="button" data-toggle="modal" class="icon-edit" title="Editar"></a>
				<?php echo $this->partial('partials/editar-cliente.phtml', array('cliente' => $cliente)); ?>                                     
                                <a href="#modal-excluir-cliente-<?php echo $cliente->id?>" role="button" data-toggle="modal" class="icon-trash" title="Excluir"></a>
				<?php echo $this->partial('partials/modal-excluir-cliente.phtml', array('cliente' => $cliente)); ?>
                                <?php endif ?>
                                <a href="<?php echo $this->baseUrl() ?>/cliente/show/id/<?php echo $cliente->id ?>" ><i class="icon-eye-open icon" data-toggle="tooltip" title="Visualizar informações detalhadas do cliente"></i></a>                
                                </td> 
                                
			</tr>
		<?php endforeach;?>
	</tbody>

</table>